Support for NiFogProperty
Now we assume that Morrowind does not use it, but it is not true.
This node can be used to override fog settings for given node, e.g. to create skyboxes (static landscape planes without fog).
Note: I assume it is not an 1.0 blocker since the node is a quite exotic.
I suppose the node can be implemented via osg::Fog:
case Nif::RC_NiFogProperty:
{
const Nif::NiFogProperty* fogprop = static_cast<const Nif::NiFogProperty*>(property);
osg::Fog* fog = new osg::Fog;
fog->setMode(osg::Fog::LINEAR);
fog->setColor(osg::Vec4f(fogprop->mColour[0], fogprop->mColour[1], fogprop->mColour[2], 255));
fog->setDensity(fogprop->mFogDepth);
fog->setStart(fogStart); // depends on viewing distance, may require double buffering
fog->setEnd(fogEnd);
osg::StateSet* stateset = node->getOrCreateStateSet();
stateset->setAttributeAndModes(fog, osg::StateAttribute::ON);
break;
}
As for flags:
1's bit: Enables Fog
2's bit: Sets Fog Function to FOG_RANGE_SQ
4's bit: Sets Fog Function to FOG_VERTEX_ALPHA
If 2's and 4's bit are not set, but fog is enabled, Fog function is FOG_Z_LINEAR.
It is unclear, what they are exactly supposed to do, excepts the first bit. When it is 0, fog should ignore target node. I suppose it can be achieved by using a huge setEnd
distance.